package com.fifth.commodity.controller.api;

import com.fifth.common.pojo.dto.CommonResult;
import com.fifth.common.pojo.entity.Deposit;
import com.fifth.commodity.service.DepositService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("api/deposit")
public class ApiDepositController {
    @Autowired
    private DepositService depositService;

    /*
    * 查询所有
    * */
    @PostMapping("/selectall")
    public CommonResult SelectAll(@RequestBody Deposit deposit){
        CommonResult commonResult = depositService.SelectAll(deposit);
        return new CommonResult(2000,"查询成功",commonResult);
    }
    /*
    * 删除
    * */
    @GetMapping("/delete/{id}")
    public CommonResult Delect(@PathVariable String id){
        CommonResult commonResult = depositService.DepositDelete(id);
        return new CommonResult(2000,"删除成功",commonResult);
    }

    /*
    * 添加
    * */
    @PostMapping("insert")
    public CommonResult Insert(@RequestBody Deposit deposit){
        CommonResult commonResult = depositService.DepositInsert(deposit);
        return new CommonResult(2000,"添加成功",commonResult);
    }
    /*
    * 修改
    * */
    @PostMapping("/update")
    public CommonResult Update(@RequestBody Deposit deposit){
        CommonResult commonResult = depositService.DepositUpdate(deposit);
        return new CommonResult(2000,"修改成功",commonResult);
    }
}

